import { IconType, IconUtil } from '@xtail/vue3'
import FileCode from '@iconify-icons/tabler/file-code'
import { genFloderIcon } from '../../../utils'
import { ScriptConfTypeConstType, ScriptConfTypeConst } from '../consts'

/**
 * 生成命令配置中的图标配置项的默认值
 *
 * @param {ScriptConfTypeConstType} type 命令配置项的类型
 * @returns {IconType} 图标配置项的默认值
 */
export const genScriptConfDefaultIcon = (
  type: ScriptConfTypeConstType = ScriptConfTypeConst.SCRIPT
): IconType => {
  if (type === ScriptConfTypeConst.DIR) return genFloderIcon()
  return IconUtil.genIcon({
    iconName: 'tabler:code',
    iconProps: {
      icon: FileCode
    }
  })
}
